// Copyright 2020 JD.com, Inc. Galileo Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ==============================================================================

#pragma once
#include <torch/extension.h>

namespace torch {
namespace glo {

using Tensors = std::vector<Tensor>;
using Fnames = std::vector<std::string>;
using Dims = std::vector<int>;
using Dtypes = std::vector<Dtype>;

Tensors CollectEntity(Tensor types, int32_t count, const std::string& category);

Tensors CollectStateNeighbor(Tensor ids, Tensor types, int32_t count,
                             bool has_weight);
Tensors CollectNeighbor(Tensor ids, Tensor types, int32_t count,
                        bool has_weight, const std::string& category);

Tensors CollectPodFeature(Tensors ids, Fnames& fnames, Dims& dims);
Tensors CollectStringFeature(Tensors ids, Fnames& fnames, Dims& dims);

Tensors CollectSeqByMultiHop(Tensor ids, const Tensors& metapath,
                             const std::vector<int>& counts, bool has_weight);
Tensor CollectSeqByRWWithBias(Tensor ids, const Tensors& metapath,
                              int repetition, float p = 1.0, float q = 1.0);
Tensor CollectPairByRWWithBias(Tensor ids, const Tensors& metapath,
                               int repetition, int context_size, float p = 1.0,
                               float q = 1.0);

}  // namespace glo
}  // namespace torch
